
module com.tangs {
	export class ClickLabel extends Laya.Label {
		private labelColors: string;
		private strokeColors: string;

		constructor() {
			super();
			this.frameOnce(1, this, this.onLoadEnd);
		}

		public onLoadEnd(): void {
			let cols = this.labelColors ? this.labelColors.split(",") : [];
			let strokeCols = this.strokeColors ? this.strokeColors.split(",") : [];

			let len = cols.length;
			let strokeLen = strokeCols.length;

			let switchCol = (idx:number): void => {
				if (len >= idx) {
					this.color = cols[idx];
				}
				if (strokeLen >= idx) {
					this.strokeColor = strokeCols[idx];
				}
			};

			this.mouseEnabled = true;
			this.on(Laya.Event.MOUSE_UP, this, (): void => {
				switchCol(0);
			});
			this.on(Laya.Event.MOUSE_DOWN, this, (): void => {
				switchCol(2);
			});

			this.on(Laya.Event.MOUSE_MOVE, this, (): void => {
				
			});

			this.on(Laya.Event.MOUSE_OVER, this, (): void => {
				switchCol(1);
			});
			this.on(Laya.Event.MOUSE_OUT, this, (): void => {
				switchCol(0);
			});
			switchCol(0);
		}
	}
}